<!DOCTYPE html>
<html  lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人信息</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/plugin/zTree_v3/css/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="/static/plugin/zTree_v3/css/demo.css">
    <script src="/static/plugin/zTree_v3/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/static/layui/layui.js"></script>
    <script src="/static/plugin/ztree/js/jquery.ztree.core.js"></script>
    <script src="/static/plugin/ztree/js/jquery.ztree.excheck.js"></script>
    <script src="/static/plugin/ztree/js/jquery.ztree.exedit.js"></script>
    <script type="text/javascript" src="/static/js/base.js"></script>
</head>
<body>
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
            <legend style="font-size:16px;">头像上传</legend>
        </fieldset>

        <div class="layui-input-inline">
            <div class="layui-upload-drag" style="margin-left:10%;" id="test10">
                <i style="font-size:30px;" class="layui-icon"></i>
                <p style="font-size: 10px">点击上传，或将文件拖拽到此处</p>
            </div>
        </div>
        <div class="layui-input-inline">

            <div  id="demo2" style="margin-top: 20px;margin-left: 50px">
                <img id="imageId" th:src="${user.photo}" width="100px" height="100px" class="layui-upload-img layui-circle">
            </div>

        </div>
    </div>
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
            <legend style="font-size:16px;">基础信息</legend>
        </fieldset>
    </div>
    <div class="layui-form-item">
        <label for="uname" class="layui-form-label">
            <span class="x-red">*</span>用户名
        </label>
        <div class="layui-input-inline">
            <input th:value="${user.userId}" type="hidden" name="id">
            <input type="text"  id="uname" th:value="${user.username}" readonly lay-verify="username"
                   autocomplete="off" class="layui-input">
        </div>
        <div id="ms" class="layui-form-mid layui-word-aux">
            <span class="x-red">*</span><span id="ums">将会成为您唯一的登入名</span>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label for="realName" class="layui-form-label">
                <span class="x-red">*</span>真实姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="realName" th:value="${user.realName}" name="realName" lay-verify="realName"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <!--<div class="layui-inline">
            <label for="age" class="layui-form-label">
                <span class="x-red">*</span>单位
            </label>
            <div class="layui-input-inline">
                <input type="text" id="age" name="age" th:value="${user.email}" lay-verify="number"
                       autocomplete="off" class="layui-input">
            </div>
        </div>-->
    </div>
    <div>
        <label for="email" class="layui-form-label">
            <span class="x-red"></span>单位
        </label>
        <div class="layui-input-block">
            <input type="email" id="email" th:value="${user.email}" style="width: 93%" name="email"  lay-verify="email"
                   autocomplete="off" class="layui-input">
            <input id="photo" th:value="${user.photo}" name="photo" type="hidden">
        </div>
    </div>
    <!--<a  class="layui-btn layui-btn-normal" lay-filter="*"  lay-submit>
        更新
    </a>-->
</form>
<script>
    layui.use('upload', function() {
        var $ = layui.jquery, upload = layui.upload;
        //拖拽上传
        upload.render({
            elem: '#test10'
            ,url: '/user/upload' //改成您自己的上传接口
            ,before: function(obj){
                //预读，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').find('img').remove();
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" width="100px" height="100px" class="layui-upload-img layui-circle">');
                });
            },done: function(res){
                if(res.code == '200'){
                    layer.msg(res.msg,{icon: 1,anim: 6});
                }else{
                    $("#photo").val(res.msg);
                }
            }
        });
    });
</script>
</body>
</html>